# 人脸检测系统API测试脚本
# 作者: fsserver
# 日期: 2024-01-01

Write-Host "正在测试人脸检测系统API..." -ForegroundColor Green

# 等待应用启动
Write-Host "等待应用启动..." -ForegroundColor Yellow
Start-Sleep -Seconds 10

# 测试健康检查接口
Write-Host "测试健康检查接口..." -ForegroundColor Cyan
try {
    $healthResponse = Invoke-RestMethod -Uri "http://localhost:8080/face-detection/api/face/health" -Method GET
    Write-Host "健康检查成功:" -ForegroundColor Green
    Write-Host ($healthResponse | ConvertTo-Json -Depth 3) -ForegroundColor White
} catch {
    Write-Host "健康检查失败: $($_.Exception.Message)" -ForegroundColor Red
}

# 测试API文档访问
Write-Host "`n测试API文档访问..." -ForegroundColor Cyan
try {
    $docResponse = Invoke-WebRequest -Uri "http://localhost:8080/face-detection/doc.html" -Method GET
    if ($docResponse.StatusCode -eq 200) {
        Write-Host "API文档访问成功，状态码: $($docResponse.StatusCode)" -ForegroundColor Green
    }
} catch {
    Write-Host "API文档访问失败: $($_.Exception.Message)" -ForegroundColor Red
}

Write-Host "`n测试完成！" -ForegroundColor Green
Write-Host "如果所有测试都通过，您可以访问以下地址：" -ForegroundColor Yellow
Write-Host "- API文档: http://localhost:8080/face-detection/doc.html" -ForegroundColor White
Write-Host "- 健康检查: http://localhost:8080/face-detection/api/face/health" -ForegroundColor White 